export default {
    increment(state){
        state.count++;
        localStorage.setItem("vuex-count",JSON.stringify(state))
    },
    incrementN(state,{n}){
        state.count +=n
        localStorage.setItem("vuex-count", JSON.stringify(state));
    },
    decrement(state){
        state.count--
        localStorage.setItem("vuex-count", JSON.stringify(state));
    },
    setMovieList(state,movieList){
        state.movieList = movieList;
        localStorage.setItem("vuex-count", JSON.stringify(state));
    }
}

//一条重要的原则就是要记住 mutation 必须是同步函数,如果是异步的话,我们无法在工具中追踪数据的变化